﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Facebook
{
    public class StaticDictionaryCache : ICacheWrapper
    {        
        private static Dictionary<String, Object> INTERNAL_DICTIONARY = new Dictionary<String, Object>();

        #region [ ICacheWrapper Members ]

        public void Add(String key, Object value)
        {
            INTERNAL_DICTIONARY.Add(key, value);
        }

        public Object Remove(String key)
        {
            Object value;
            INTERNAL_DICTIONARY.TryGetValue(key, out value);
            INTERNAL_DICTIONARY.Remove(key);
            return value;
        }

        public Boolean ContainsKey(String key)
        {
            return INTERNAL_DICTIONARY.ContainsKey(key);
        }

        public Int32 Count
        {
            get { return INTERNAL_DICTIONARY.Count; }
        }

        public Object this[String key]
        {
            get { return INTERNAL_DICTIONARY[key]; }
            set { INTERNAL_DICTIONARY[key] = value; }
        }

        #endregion
    }
}